﻿using DataAccess;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace KhoaLuan.MainSys.Manager
{
    public partial class Admin : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //object[] a = { Session.GetCurrentUser().UserName, Session.GetCurrentUser().Password, 0 };
            var controlid = Request.QueryString["ControlID"];
            if (controlid != null)
            {
                int controlID = int.Parse(controlid);
                if (controlID == 1)
                    Response.Redirect("/MainSys/Home.aspx");
                else
                {
                    if (controlID == 3)
                        Response.Redirect("/MainSys/Manager/Articles/MgrArticle.aspx");
                    else
                    {
                        var proxymenu = new tbMenu_Proxy();
                        tbMenu tam = proxymenu.GetById_tbMenu_Proxy(int.Parse(controlid)).ToObject<tbMenu>();
                        if (tam != null)
                        {
                            //kiem tra quyen
                            placeholder.Controls.Clear();
                            placeholder.Controls.Add(LoadControl(tam.Link));
                        }
                        else
                        {
                            placeholder.Controls.Add(LoadControl("~/Account/MyFileUC.ascx"));
                        }
                    }
                }
            }
            else
            {
                placeholder.Controls.Add(LoadControl("~/Account/MyFileUC.ascx"));
            }

        }
    }
}